package com.zyh.websocket.controller;

import com.zyh.common.core.controller.BaseController;
import com.zyh.websocket.entity.Message;
import com.zyh.websocket.service.MessageSenderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 聊天controller
 *
 * @author ZYH
 * @version 1.0
 * @date 2025-03-23
 */
@RequestMapping("/chat/chat")
@RestController("webSocketChatController")
public class ChatController extends BaseController {
    @Autowired
    private MessageSenderService messageSenderService;


    @PostMapping("/all")
    public void all(@RequestBody Message message) {
        logger.info("all入参->{}", message);
        messageSenderService.broadcastSystemMessage(message);
    }

}
